import Router from 'koa-router';
import {addCollection} from '../chroma/index.js'
const create_knowledge_base = new Router();

create_knowledge_base.post('/', async (ctx) => {
    try {
        const { knowledge_base } = ctx.request.body
        await addCollection(knowledge_base)
        ctx.body = {
            code: 200,
            message: 'success'
        };
    }catch (e) {
        ctx.status = 500
        ctx.body = {
            code: 500,
            message: '服务器内部错误'
        }
        console.log(e.name + "：" + e.message)
    }
})
export default create_knowledge_base
